﻿namespace NTLib.Core.Configuration
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Linq;
    using System.Text;
    using System.Threading;
    using System.Threading.Tasks;

    /// <summary>
    /// Define how to found the default configuration file, class, ...
    /// </summary>
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
    public abstract class BaseConfigurationAttribute : Attribute, IConfigurationProvider
    {
        #region Properties

        /// <summary>
        /// Gets or sets a value indicating whether this configuration attribute override all the other configuration attribute.
        /// </summary>
        /// <value>
        ///   <c>true</c> if this configuration attribute override the other; otherwise, <c>false</c>.
        /// </value>
        [DefaultValue(false)]
        public bool OverrideAllTheOther { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this configuration attribute override all the other configuration attribute parent of the same type. 
        /// </summary>
        /// <value>
        ///   <c>true</c> if this configuration attribute override the other; otherwise, <c>false</c>.
        /// </value>
        [DefaultValue(false)]
        public bool OverrideParent { get; set; }

        #endregion

        #region Methods

        /// <summary>
        /// Collects the configuration value.
        /// </summary>
        /// <returns>Return the collection of value extract from the describe process</returns>
        public abstract ConfigurationCollection CollectConfigurationValue(Type host, object context = null, CancellationToken token = default(CancellationToken));

        #endregion
    }
}
